package com.study.group.modules.mongo.service.impl;

import com.study.group.common.entrty.Person;
import com.study.group.modules.mongo.dao.PersonDao;
import com.study.group.modules.mongo.dao.PersonDao2;
import com.study.group.modules.mongo.service.PersonService;
import com.study.group.modules.mongo.service.PersonService2;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description service 类
 * @Author      yanghanwei
 * @Mail        yanghanwei@geotmt.com
 * @Date        2019/4/26 12:02
 * @Version     v1
 **/
@Service
public class PersonServiceImpl implements PersonService {

    private static final Logger logger = LoggerFactory.getLogger(PersonServiceImpl.class);

    @Resource
    private PersonDao personDao;

    @Override
    public List<Person> list() {
        logger.info("--------------------->[MongoDB service list start]");
        return  personDao.list();
    }

    @Override
    public Person save(Person person) {
        logger.info("--------------------->[MongoDB service save start]");
        return personDao.save(person);
    }


    @Override
    public Person getById(String id) {
        logger.info("--------------------->[MongoDB service getById start]");
        return personDao.getById(id);
    }

    @Override
    public List<Person> getByName(String name) {
        logger.info("--------------------->[ service getByName start]");
        return personDao.getByName(name);
    }

    @Override
    public Integer update(Person person) {
        logger.info("--------------------->[MongoDB service update start]");
        return personDao.update(person);
    }

    @Override
    public Integer delete(Person person) {
        logger.info("--------------------->[MongoDB service delete start]");
        return personDao.delete(person);
    }

    @Override
    public Integer deleteById(String id) {
        logger.info("--------------------->[MongoDB service deleteById start]");

        return personDao.deleteById(id);
    }
}
